class Clock extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      isToggleOn : true 
    }
    this.handleClick = this.handleClick.bind(this);
  }
  handleClick() {
    this.setState({
      isToggleOn: !this.state.isToggleOn
    })
  }
  handleInput(e) {
    console.log(e.target.value);
    if(e.keyCode == 13) {
      console.log(e.target.value);
    }
  }
  render() {
    return (
      <div>
        <h2>toggle state: {this.state.isToggleOn ? 'ON' : 'OFF' }</h2>
        <button onClick={this.handleClick}>toggle</button>
        <input onInput={this.handleInput.bind(this)} />
      </div>
    );
  }
}
ReactDOM.render(
  <Clock />,
  document.getElementById('root')
);